package org.example.springaop.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Slf4j
public class AspectDemo1 {
     @Around("@annotation(org.example.springaop.aspect.TimeRecord)")
    public Object test(ProceedingJoinPoint joinPoint){
        log.info("方法执行前: Around");
        Object result = null ;
        try {
            result =  joinPoint.proceed();
        } catch (Throwable e) {
           log.error(joinPoint.toShortString()+"发生错误");
        }
        log.info("方法执行后: Around");
        return result;
    }

}
